<?php
class Shop_Form_AttrSet_Add extends Promotor_Form_Scaffold {
	public function init() {
		$this->setMethod('post');
		$this->setAttrib('enctype', Zend_Form::ENCTYPE_MULTIPART);

		$this->addPrefixPath('Promotor_Form_Decorator_','Promotor/Form/Decorator', self::DECORATOR);
        
		$subForm = $this->_getContentForm();
        $this->addSubForm($subForm, 'contenttab');
	}
	

	/**
     * @return Zend_Dojo_Form_SubForm
     */
    protected function _getContentForm() {
    	$subForm = new Zend_Form_SubForm();
        $subForm->setAttribs(array(
            'name'   => 'contenttab',
            'legend' => 'Zestaw atrybutów',
        ));
        $subForm
        	->addElement(
                'text',
                'name',
                array(
                    'label' => 'Nazwa zestawu',
                    'required'  => true,
                )
            );

        $attribs = new KontorX_Form_Element_Db_MultiCheckbox('attribs', array(
        	'label' => 'Atrybuty',
        	'description' => 'Wybierz atrybuty wchodzące w skład zestawu',
        	'firstNull' => false,
        	'required' => true,
        	'tableName' => 'shop_product_attr',
            'tableCols' => array('key' => 'id','value' => 'name'),
        	
        ));
        $attribs->setIsArray(true);

        $subForm->addElement($attribs);
            
        return $subForm;
    }
}